package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;
//课程订单实体类
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;

@Data
public class CourseOrder {
    private Long id;
    //销售时间（录入时间）
    private Date inputTime;
    //客户
    private Customer customer;
    //课程
    private SystemDictionaryItem course;
    //销售金额
    private BigDecimal money;

    public String getJson(){
        //封装自身的数据
        HashMap map = new HashMap();
        map.put("id",id);
        map.put("inputTime",inputTime);
        map.put("money",money);
        if(customer!=null){
            map.put("customerId",customer.getId());
        }
        if(course!=null){
            map.put("courseId",course.getId());
        }
        return JSON.toJSONString(map);
    }
}